home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- IFF
-
- Version 2.0
-
-
-
-
-
-
-
-
-
-
-
-
-
- By John Knauer,Jr.
-
- Source # BCA717
- CompuServe # 75236,1466
-
-
-
-
-
-
-
-
-
- Copyright (C) 1986 by John Knauer,Jr
- ALL RIGHTS RESERVED.
-
-
-
-
-
-
-
-
-
-
-
-
-
- May 1986
-
-
-
-
-
-
-
-
-
-
-
- Preface
- -------
-
- IFF is a powerful BATch file utility, that performs a
- multitude of functions, from asking a simple Y/N question to
- check to see if a disk is formatted.
-
- Unlike other smaller utilities, IFF incorporates several
- utilities in one package under one name, IFF.
-
- IFF is a small program (yes, I consider 14k small these
- days), but if you plan on using it alot, you might want to put
- it on your RAMdrive.
-
- IFF uses DOS' ERRORLEVEL BATch variable to let your BATch
- file know what IFF has or has not found ( for more information
- on ERRORLEVEL check your DOS manual). By following IFF with
- several of DOS' IF ERRORLEVEL ... commands, you can test the
- return codes and take apporpriate action.
-
- IFF is the Copyrighted property of John Knauer,Jr. You are
- granted a limited license to use IFF, and to copy it and
- distribute it, provided that (1) no fee may be charged for such
- copying and distribution, (2) IFF may ONLY be distributed in its
- original unmodified state.
-
- You may not use this product in a commercial environment
- or a government organization without paying a license fee.
- Site licenses and commercial distribution licenses are available.
- Contact:
-
- John Knauer,Jr
- 6 Horseshoe Dr
- Brookfield,CT 06804
-
- for more details.
-
- I will support this utility and it will continue to grow.
- So, Copy it, Use it, Let me know if you like it (or not).
-
- The documentation is in alphabetic order and in the back
- are some sample BATch files in case you don't get them with the
- .ARC file.
-
- I'd like to thank Mike Todd for his suggestions and his
- help with this documentation.
-
- ENJOY!
-
- CT-John
-
-
-
-
- IFF v2.0 May 1986
-
-
-
-
-
-
-
-
-
-
-
- Page 1
-
-
-
- Syntax
- ------
-
- IFF <option> <parameter>
-
-
- Definitions
- -----------
-
- d: Disk Drive.
-
- \path\ Pathname (if applicable).
-
- filename.ext The name of the file to
- which the option applies
- (Wild Cards are NOT allowed).
-
- TEXT Single line of text to be
- displayed on the screen.
-
- SIZE Number of K for which a drive
- is being tested.
-
-
- Options Parameters
- ------- ----------
-
- E - Exist d:\path\filename.ext <2>
- M - Menu d:\path\filename.ext
- Q - Question TEXT
- R - seaRch d:\path\filename.ext
- S - Size d: SIZE
- ?/space-blank -none- gives online reference
-
-
- Errorlevel Codes
- ----------------
-
- 99 Disk Drive door open or File not found
- 89 Disk is not Formatted
- 79 Not enough room
- 69 Parameter invalid -- Will beep with error message
- 20 File not found or NO ['Q' option]
- 1-10 Search's return code (See Text)
- 0-3 Menu responses
- 0 All went well or YES [ 'Q' Option]
-
-
-
-
- IFF v2.0 May 1986
-
-
-
-
-
-
-
-
-
-
-
- Page 2
-
-
-
- IFF E d:\path\filename.ext <2>
- -------------------------------
-
- The Exist option tests for the existance of the specified file.
- Unlike DOS' EXIST BATch file command, if the disk drive door is open,
- you won't get the 'Abort,Retry or Ignore' error message.
-
- IFF sets DOS' ERRORLEVEL BATch variable to 99 if the file does
- not exist or the disk drive door is open (default), with the 2 option
- ERRORLEVEL is set to 99 if there is no disk in the drive and 20 if
- there is a disk, but the file was not found. If the file exists
- ERRORLEVEL is set to 0.
-
- Example:
- -------
-
- If you wanted to test for the existence of a file named
- PROGRAM.BAT in the subdirectory named \BATCH on drive D:, you
- would use the following command:
-
- IFF E D:\BATCH\PROGRAM.BAT
-
- If you needed to test not only for a disk, but also the
- file, then you would use:
-
- IFF E D:\BATCH\PROGRAM.BAT 2
-
- this will cause to report 99 if there is no disk in drive D:,
- or 20 if there is a disk, but the file was not found.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- IFF v2.0 May 1986
-
-
-
-
-
-
-
-
-
-
-
- Page 3
-
-
-
- IFF M d:\path\filename.ext
- --------------------------
-
- This is an 'extension' of the Question option, discussed later,
- that allows for more than a YES or NO response. Filename is a text
- file you create in the form of a menu with options numbered 0-3.
-
- IFF will set DOS' ERRORLEVEL BATch variable to your response,
- ie., a response of 1 will set ERRORLEVEL to 1 etc. If the specified
- text file can not be found, IFF will set ERRORLEVEL to 69.
-
-
- Example:
- -------
-
- C:\MENU.FIL contains --> : This is a test menu
- : Start your favorite program
- : Your options are:
- :
- : 1 - Your Spreadsheet
- : 2 - Your Database
- : 3 - Your Word Processor
- : 0 - End
- :
- :
- When you invoke IFF by --> : IFF M C:\MENU.FIL
- :
- : This is a test menu
- IFF will print the text : Start your favorite program
- file and prompt you with : Your options are:
- "Choice ?" --> :
- : 1 - Your Spreadsheet
- : 2 - Your Database
- : 3 - Your Word Processor
- : 0 - End
- :
- : Choice ?
-
- Only 0,1,2 or 3 is accepted. The prompt will remain on
- the screen until the correct number is pressed.
-
-
-
-
-
-
-
-
-
-
- IFF v2.0 May 1986
-
-
-
-
-
-
-
-
-
-
-
- Page 4
-
-
-
- IFF Q TEXT
- ----------
-
- Question simply prompts you for a Y(es) or N(o) response. The
- text can be any question, up to 80 characters long, that can be
- answered with a Y or N.
-
- IFF sets DOS' ERRORLEVEL BATch variable to 20 when the response
- is N(o) and to 0 with a Y(es) response.
-
- Only Y,y,N or n is accepted. The prompt remains on the
- screen until either the Y or N key is pressed.
-
- ECHO off will supress the printing of the command line and
- will display the TEXT along with the Y(es) or N(o) ? prompt.
-
- Example:
- -------
-
- IFF Q This is a sample question for display
-
- DISPLAYS:
-
- This is a sample question for display
- Y(es) or N(o) ?
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- IFF v2.0 May 1986
-
-
-
-
-
-
-
-
-
-
-
- Page 5
-
-
-
- IFF R d:\path\filename.ext
- --------------------------
-
- Search is an extension of Exist. With Search, you create
- a text file with a list, of up to 10 filename, that you wish to
- test for their existence.
-
- Search sets DOS' ERRORLEVEL BATch variable to 99 if the
- drive door is open, the text file is empty or there are no matches.
- 69 if there is an invalid command parameter or 1-10 based on
- the filenames position when found.
-
- Example:
- -------
- Filename
- --------
-
- C:\FILE.LST contains --> : C:\STARTUP.BAT
- : B:\SETUP1.BAT
- : A:\MACRO.COM
- : D:\MP.COM
- : D:\MENU.BAT
- :
- :
- When you invoke IFF with --> : IFF R C:\FILE.LST
-
-
- IFF will test for the existance of each filename listed in
- C:\FILE.LST until it finds a match. IFF will set ERRORLEVEL
- to the matching code of the file it found.
-
- If C:\STARTUP.BAT is found, the return code will be 1.
- If A:\MACRO.COM is found first (the first 2 were not), then
- the return code will be 3, and so on.
-
- IFF will return a 99 if there are no matches at all.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- IFF v2.0 May 1986
-
-
-
-
-
-
-
-
-
-
-
- Page 6
-
-
-
- IFF S d: SIZE
- -------------
-
- Size allows you to test the amount of available space on a
- specified drive, AND it also lets you test to see if a disk in
- the drive is formatted!
-
- IFF sets DOS' ERRORLEVEL BATch variable to 99 if the drive
- door is open, 89 if the disk is NOT formatted, 79 if there is not
- enough room [see note!!], based on the amount you specify or 0 if
- everything goes OK.
-
-
- *NOTE:
- An empty formatted floppy disk, formatted under DOS 2.x or later
- DOES NOT really contain 360k of space. The actual size is 354k (that
- one kept me going for a few minutes, when I was checking for bugs).
-
- PLEASE use only the 'K' amount. For example; 12,288 is 12k,
- 262,144 is 256k not 262k. If you need 512,485 you can test with
- 500.4736 or 501, just to be sure.
-
- Example:
- -------
-
- If you wanted to test the disk in drive C: for 128k of free
- space, from within your BATch file, you would include the line:
-
- IFF S C: 128
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- IFF v2.0 May 1986
-
-
-
-
-
- .
- .
-
-
-
-
- Appendix 1
-
-
-
-
- REM IFF_E.BAT
- ECHO OFF : suppress display of commands
- CLS : clear the screen
- :START : Starting header
- IFF E A:\TEST.QWA 2 : test for A:\TEST.QWA
- IF ERRORLEVEL 99 GOTO OPEN : errorlevel check
- IF ERRORLEVEL 20 GOTO THERE : .
- :OPEN : No disk in drive header
- ECHO PLEASE MAKE SURE THERE IS A DISK :
- IN DRIVE A: :
- PAUSE : pause
- GOTO START : jump to Start header
- :THERE : Disk is present header
- ECHO CREATING A:\TEST.QWA FOR DEMO :
- ECHO HERE > A:\TEST.QWA : creates A:\TEST.QWA
- IFF E A:\TEST.QWA 2 : test for A:\TEST.QWA
- IF ERRORLEVEL 99 GOTO OPEN : errorlevel check
- IF ERRORLEVEL 20 GOTO THERE : .
- :WORKED : Second file exists header
- ECHO A:\TEST.QWA IS PRESENT ON DRIVE A: :
- ECHO NOW REMOVE THE DISK IN DRIVE A: :
- PAUSE : pause
- IFF E A:\TEST.QWA : make sure the right disk is back
- IF ERRORLEVEL 99 GOTO GONE : errorlevel check
- GOTO WORKED : jump to Second file exists header
- :GONE : Opps disk not back yet
- ECHO NOW PUT THE DISK BACK IN DRIVE A: :
- ECHO AND I WILL REMOVE A:\TEST.QWA :
- PAUSE : pause
- IFF A:\TEST.QWA : test to see if disk is back
- IF ERRORLEVEL 99 GOTO GONE : errorlevel check
- ECHO DELETING A:\TEST.QWA :
- DEL A:\TEST.QWA : delete file and End of BATch file
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- IFF v2.0 May 1986
-
-
-
-
-
-
-
-
-
-
-
- Appendix 2
-
-
-
- REM IFF_M.BAT
- ECHO OFF : suppress display of commands
- CLS : clear the screen
- IFF M MENU.FIL : start the menu display
- IF ERRORLEVEL 99 GOTO NO_FILE : errorlevel checks
- IF ERRORLEVEL 69 GOTO END : .
- IF ERRORLEVEL 3 GOTO 3 : .
- IF ERRORLEVEL 2 GOTO 2 : .
- IF ERRORLEVEL 1 GOTO 1 : .
- GOTO END_1 : if none of the above it was 0
- :NO_FILE : can't find file header
- ECHO MENU TEXT FILE MISSING OR :
- INVALID, OR DRIVE DOOR IS OPEN :
- GOTO END : jump to End of BATch file
- :3 : response 3 header
- ECHO YOU CHOSE YOUR WORD PROCESSOR :
- GOTO AGAIN : jump to run IFF_M again
- :2 : response 2 header
- ECHO YOU CHOSE YOUR DATABASE :
- GOTO AGAIN : jump to run IFF_M again
- :1 : response 1 header
- ECHO YOU CHOSE YOUR SPREADSHEET :
- :AGAIN : run IFF_M again header
- ECHO : display status of ECHO
- ECHO GOING BACK TO THE MENU :
- IFF_M : run IFF_M again
- :END_1 : response 0 header
- ECHO YOU CHOSE TO END :
- :END : End of BATch file
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- IFF v2.0 May 1986
-
-
-
-
-
-
-
-
-
-
-
- Appendix 3
-
-
-
- REM IFF_Q.BAT
- ECHO OFF : suppress display of commands
- CLS : clear the screen
- IFF Q DO YOU WANT TO CONTINUE : ask the question
- IF ERRORLEVEL 1 GOTO NO : errorlevel check
- ECHO YOUR ANSWER WAS YES : if code was 0
- GOTO END : jump to End of BATch file
- :NO : answer was NO header
- ECHO YOUR ANSWER WAS NO :
- :END : End of BATch file
-
-
- There are so many ways and uses for this command.
- This is one small demo, but if you look at Appendix 5 (IFF_S.BAT)
- you will see how it can be incorporated into a large BATch file.
- You will also see how nice it is to use the same program
- to do several jobs.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- IFF v2.0 May 1986
-
-
-
-
-
-
- Appendix 4
- REM IFF_R.BAT
- ECHO OFF : suppress display of commands
- CLS : clear the screen
- IFF R FILE.LST : search through file.lst
- IF ERRORLEVEL 99 GOTO 99 : errorlevel checks
- IF ERRORLEVEL 69 GOTO 69 : .
- IF ERRORLEVEL 10 GOTO 10 : .
- IF ERRORLEVEL 9 GOTO 9 : .
- IF ERRORLEVEL 8 GOTO 8 : .
- IF ERRORLEVEL 7 GOTO 7 : .
- IF ERRORLEVEL 6 GOTO 6 : .
- IF ERRORLEVEL 5 GOTO 5 : .
- IF ERRORLEVEL 4 GOTO 4 : .
- IF ERRORLEVEL 3 GOTO 3 : .
- IF ERRORLEVEL 2 GOTO 2 : .
- IF ERRORLEVEL 1 GOTO 1 : .
- GOTO END_1 : if we get here we have a problem
- :99 : 99 header
- ECHO NO MATCHING FILES FOUND OR :
- ECHO FILE.LST CONTAINS NO FILENAMES :
- GOTO END : jump to End header
- :69 : 69 header
- ECHO NO FILE.LST FILE FOUND :
- GOTO END :
- :10 : 10 header
- ECHO Return code 10 :
- GOTO END : jump to End header
- :9 : 9 header
- ECHO Return code 9 :
- GOTO END : jump to End header
- :8 : 8 header
- ECHO Return code 8 :
- GOTO END : jump to End header
- :7 : 7 header
- ECHO Return code 7 :
- GOTO END : jump to End header
- :6 : 6 header
- ECHO Return code 6 :
- GOTO END : jump to End header
- :5 : 5 header
- ECHO Return code 5 :
- GOTO END : jump to End header
- :4 : 4 header
- ECHO Return code 4 :
- GOTO END : jump to End header
- :3 : 3 header
- ECHO Return code 3 :
- GOTO END : jump to End header
- :2 : 2 header
- ECHO Return code 2 :
- GOTO END : jump to End header
- :1 : 1 header
- ECHO Return code 1 :
- GOTO END : jump to End header
- :END_1 : Problem header
- ECHO Problem :
- :END : End of BATch header
-
- IFF v2.0 May 1986
-
-
-
-
-
-
-
- Appendix 5
-
-
-
-
- REM IFF_S.BAT
- :START : Starting header
- ECHO OFF : suppress display of commands
- CLS : clear the screen
- ECHO WE'LL TEST FOR 128K IN DRIVE A :
- IFF S A: 128 : test drive A: for 128k
- IF ERRORLEVEL 99 GOTO NO_FILE : errorlevel checks
- IF ERRORLEVEL 89 GOTO NOT_FORM : .
- IF ERRORLEVEL 79 GOTO NO_SPACE : .
- IF ERRORLEVEL 69 GOTO STOP : .
- GOTO OK : if none of the above all went well
- :NO_FILE : No file found header
- ECHO THERE IS NO DISK IN DRIVE A: :
- ECHO PLEASE PUT A DISK IN DRIVE A: :
- PAUSE : pause
- GOTO START : re-start
- :NOT_FORM : Disk not formatted header
- ECHO THE DISK IN DRIVE A: IS NOT :
- FORMATTED :
- GOTO END : jump to End header
- :NO_SPACE : Not enough space header
- ECHO THE DISK IN DRIVE A: HAS LESS :
- THAN 128K OF SPACE :
- GOTO END : jump to End header
- :OK : Enough space header
- ECHO THE DISK IN DRIVE A: HAS 128K :
- OR MORE OF SPACE :
- GOTO END : jump to End header
- :END : End header
- IFF Q DO YOU WANT TO TRY ANOTHER : test to see if you want to do it
- DISK IN DRIVE A: : again or not
- IF ERRORLEVEL 20 GOTO STOP : errorlevel check
- ECHO PUT ANOTHER DISK IN DRIVE A: : if not 20 then it's 0
- PAUSE : pause
- GOTO START : jump to Start header
- :STOP : End of BATch file
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- IFF v2.0 May 1986
-
-
-
-
-